package com.qqbot.impl.thread;

import lombok.extern.slf4j.Slf4j;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

/**
 * 流阻塞处理
 *
 * @author changwenpeng
 * @email *****@mail.com
 * @date 2021-5-28 23:47:56
 */
@Slf4j
public class StreamInformatonRunnable implements Runnable {
    private BufferedReader br;

    public StreamInformatonRunnable(BufferedReader br) {
        this.br = br;
    }

    public void run() {
        try {
            String line = null;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
                log.info(line);
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
        }
    }
}
